<!--
 * @Description: 
 * @Autor: ZachGmy
 * @Date: 2021-06-21 10:05:45
 * @LastEditors: ZachGmy
 * @LastEditTime: 2021-06-21 14:56:12
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* 子元素的宽高 */
    div {
      width: 50px;
      height: 50px;
    }

    /* 父元素的宽高 */
    .father {
      width: 300px;
      height: 200px;
      background-color: gray;
      margin: 100px auto;
      display: flex;
    }

    .div1 {
      background-color: red;
    }

    .div2 {
      background-color: yellow;
      flex-grow: 2;
    }

    .div3 {
      background-color: blue;
      /* 设置一个富余控件占用的属性 */
      flex-grow: 1;
    }
  </style>
</head>

<body>
  <div class="father">
    <div class="div1">1</div>
    <div class="div2">2</div>
    <div class="div3">3</div>
  </div>
</body>

</html>